#!/bin/bash

# t - Ceedling快捷命令脚本
filename=uart_getData

# 检查是否提供了参数
if [ $# -eq 0 ]; then
    echo "用法: t [命令]"
    echo "可用命令:"
    echo "  t   执行 ceedling test"
    echo "  g   执行 ceedling gcov"
    echo "  c   执行 ceedling clean"
    exit 1
fi

# 根据参数执行相应命令
case "$1" in
    "t")
        echo "执行: ceedling clean"
        sleep 0.5  # 等待1秒
        ceedling clean
        echo "执行: ceedling test:$filename"
        sleep 0.5  # 等待1秒
        ceedling test:$filename
        ;;
    "g")
        echo "执行: ceedling gcov:$filename"
        sleep 0.5  # 等待1秒
        ceedling gcov:$filename
        ;;
    "c")
        echo "执行: ceedling clean"
        sleep 0.5  # 等待1秒
        ceedling clean
        ;;
    *)
        echo "错误: 未知命令 '$1'"
        echo "可用命令: t, g, c"
        exit 1
        ;;
esac

exit 0
